import { ref, onMounted } from "vue";

const useBanner = () => {
  const bannerList = ref<string[]>([]);
  onMounted(() => {
    fetch("http://www.pudge.wang:4000/home/banner")
      .then((response) => response.json())
      .then((res) => {
        if (res.status === "0") {
          bannerList.value = res.result.list;
        }
      });
  });

  return [bannerList];
};

export default useBanner;
